/*
 * MP3_Beaney - The MP3 Tag Editor is a free ID3-Tag Editor
 * Copyright (C) 2012 Bernhard Teismann, André Seipelt, Steffen Gruschka, Imanuel Rohlfing
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package uInterface;

import java.awt.Color;

/**
 * Panel for the Control Elements which are being used to rename Files and/or Folders.
 *
 * @author Steffen Gruschka
 * @author Bernhard Teismann
 * @author André Seipelt
 * @author Imanuel Rohlfing
 * @version 1.0
 */
public class Step4 extends javax.swing.JPanel {

    /**
     * Creates new form Step4
     */
    public Step4(){
        initComponents();
        nC = new Color(0xd1c9a1);
        setTextfields();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        dragNumber = new javax.swing.JTextField();
        dragTitle = new javax.swing.JTextField();
        dragArtist = new javax.swing.JTextField();
        dragAlbum = new javax.swing.JTextField();
        dragYear = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        step4TextRenameData = new javax.swing.JTextField();
        step4CheckData = new javax.swing.JCheckBox();
        step4CheckOrder = new javax.swing.JCheckBox();
        step4TextRenameOrder = new javax.swing.JTextField();

        setBackground(new java.awt.Color(255, 255, 255));
        setPreferredSize(new java.awt.Dimension(970, 400));

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel6.setFont(new java.awt.Font("Rockwell", 1, 18)); // NOI18N
        jLabel6.setText("Verfügbare Tags");

        dragNumber.setFont(new java.awt.Font("Rockwell", 0, 13)); // NOI18N
        dragNumber.setText("<Nummer>");
        dragNumber.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                dragNumberMousePressed(evt);
            }
        });

        dragTitle.setFont(new java.awt.Font("Rockwell", 0, 13)); // NOI18N
        dragTitle.setText("<Titel>");
        dragTitle.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                dragTitleMousePressed(evt);
            }
        });

        dragArtist.setFont(new java.awt.Font("Rockwell", 0, 13)); // NOI18N
        dragArtist.setText("<Künstler>");
        dragArtist.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                dragArtistMousePressed(evt);
            }
        });

        dragAlbum.setFont(new java.awt.Font("Rockwell", 0, 13)); // NOI18N
        dragAlbum.setText("<Album>");
        dragAlbum.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                dragAlbumMousePressed(evt);
            }
        });

        dragYear.setFont(new java.awt.Font("Rockwell", 0, 13)); // NOI18N
        dragYear.setText("<Jahr>");
        dragYear.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                dragYearMousePressed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jLabel6)
                .add(14, 14, 14))
            .add(jPanel1Layout.createSequentialGroup()
                .add(28, 28, 28)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, dragYear, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, dragAlbum, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, dragTitle, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, dragArtist, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(dragNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(24, 24, 24)
                .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(dragNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(dragTitle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(dragArtist, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(dragAlbum, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(dragYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));

        step4TextRenameData.setDisabledTextColor(new java.awt.Color(153, 153, 153));

        step4CheckData.setBackground(new java.awt.Color(255, 255, 255));
        step4CheckData.setFont(new java.awt.Font("Rockwell", 0, 14)); // NOI18N
        step4CheckData.setText("Dateien Umbenennen");
        step4CheckData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                step4CheckDataActionPerformed(evt);
            }
        });

        step4CheckOrder.setBackground(new java.awt.Color(255, 255, 255));
        step4CheckOrder.setFont(new java.awt.Font("Rockwell", 0, 14)); // NOI18N
        step4CheckOrder.setText("Ordner Umbenennen");
        step4CheckOrder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                step4CheckOrderActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(33, 33, 33)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(step4CheckOrder)
                        .add(step4TextRenameData)
                        .add(step4TextRenameOrder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 417, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(step4CheckData))
                .addContainerGap(123, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(47, 47, 47)
                .add(step4CheckData)
                .add(6, 6, 6)
                .add(step4TextRenameData, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(step4CheckOrder)
                .add(7, 7, 7)
                .add(step4TextRenameOrder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(100, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(80, 80, 80)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(130, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(71, 71, 71)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(55, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Setter for MainInterface.
     * <p/>
     * @param mi ManiInterface
     */
    public void setMainInterface(MainInterface mi){
        mainInterface = mi;
    }

    /**
     * Defines Tag-Textfields for not being editable and beeing enabled for Drag and Drop
     * Disables Textfields for Data and Order and sets their color
     */
    public void setTextfields(){
        step4TextRenameData.setEnabled(false);
        step4TextRenameOrder.setEnabled(false);
        step4TextRenameData.setDragEnabled(true);
        step4TextRenameData.setBackground(nC);
        step4TextRenameOrder.setBackground(nC);
        dragNumber.setDragEnabled(true);
        dragNumber.setEditable(false);
        dragArtist.setDragEnabled(true);
        dragArtist.setEditable(false);
        dragTitle.setDragEnabled(true);
        dragTitle.setEditable(false);
        dragYear.setDragEnabled(true);
        dragYear.setEditable(false);
        dragAlbum.setDragEnabled(true);
        dragAlbum.setEditable(false);
    }

    /**
     * Checks if step4CheckData is selected.
     * <p/>
     * @return true if Data-Checkbox is selected
     */
    public Boolean isData(){
        return step4CheckData.isSelected();
    }

    /**
     * Checks if step4CheckOrder is selected.
     * <p/>
     * @return true if Order-Checkbox is selected
     */
    public Boolean isOrder(){
        return step4CheckOrder.isSelected();
    }

    /**
     * Getter for step4TextRenameData.
     * <p/>
     * @return String from Data-Textfield
     */
    public String getDataString(){
        return step4TextRenameData.getText();
    }

    /**
     * Getter for step4TextRenameOrder.
     * <p/>
     * @return String from Order-Textfield
     */
    public String getOrderString(){
        return step4TextRenameOrder.getText();
    }

    /*
     * ActionListener for the "Rename Data Checkbox".
     * Changes Color for the Textfields and activates or deactivates the Textfields.
     */
    private void step4CheckDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_step4CheckDataActionPerformed
        if (step4CheckData.isSelected()){
            step4TextRenameData.setEnabled(true);
            step4TextRenameData.setBackground(Color.white);
        }
        if (!step4CheckData.isSelected()){
            step4TextRenameData.setEnabled(false);
            step4TextRenameData.setBackground(nC);
        }
    }//GEN-LAST:event_step4CheckDataActionPerformed

    /*
     * ActionListener for the "Rename Order Checkbox".
     * Changes Color for the Textfields and activates or deactivates the Textfields.
     */
    private void step4CheckOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_step4CheckOrderActionPerformed

        if (step4CheckOrder.isSelected()){
            step4TextRenameOrder.setEnabled(true);
            step4TextRenameOrder.setBackground(Color.white);
        }
        if (!step4CheckOrder.isSelected()){
            step4TextRenameOrder.setEnabled(false);
            step4TextRenameOrder.setBackground(nC);
        }
    }//GEN-LAST:event_step4CheckOrderActionPerformed

    /*
     * Provides Selection for Drag and Drop for Tags
     */
    private void dragNumberMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dragNumberMousePressed
        dragNumber.selectAll();
    }//GEN-LAST:event_dragNumberMousePressed

    /*
     * Provides Selection for Drag and Drop for Tags
     */
    private void dragTitleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dragTitleMousePressed
        dragTitle.selectAll();
    }//GEN-LAST:event_dragTitleMousePressed

    /*
     * Provides Selection for Drag and Drop for Tags
     */
    private void dragArtistMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dragArtistMousePressed
        dragArtist.selectAll();
    }//GEN-LAST:event_dragArtistMousePressed

    /*
     * Provides Selection for Drag and Drop for Tags
     */
    private void dragAlbumMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dragAlbumMousePressed
        dragAlbum.selectAll();
    }//GEN-LAST:event_dragAlbumMousePressed

    /*
     * Provides Selection for Drag and Drop for Tags
     */
    private void dragYearMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dragYearMousePressed
        dragYear.selectAll();
    }//GEN-LAST:event_dragYearMousePressed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField dragAlbum;
    private javax.swing.JTextField dragArtist;
    private javax.swing.JTextField dragNumber;
    private javax.swing.JTextField dragTitle;
    private javax.swing.JTextField dragYear;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JCheckBox step4CheckData;
    private javax.swing.JCheckBox step4CheckOrder;
    private javax.swing.JTextField step4TextRenameData;
    private javax.swing.JTextField step4TextRenameOrder;
    // End of variables declaration//GEN-END:variables
    private MainInterface mainInterface;
    Color nC;
}
